import java.util.*;

public class Client {
    public static void main(String[] args) throws InterruptedException {
        final PaperList listOfRainy = new PaperList("Rainy", Arrays.asList(
                new Thesis("Science Thesis"),
                new ConferencePaper("AI Conference"),
                new JournalPaper("Quantum Journal"),
                new JournalPaper("Software Engineering"),
                new Thesis("Machine Learning"),
                new ConferencePaper("Data Mining")
        ));

        final List<Student> students = Arrays.asList(
                new Student("Alice", 2, PaperType.Thesis),
                new Student("Bob", 1, PaperType.JournalPaper),
                new Student("Cindy", 3, PaperType.Any),
                new Student("David", 2, PaperType.ConferencePaper)
        );

        List<Thread> threads = new ArrayList<>();
        for (Student student : students) {
            Thread t = new Thread(() -> listOfRainy.selectPaperByRandom(student));
            threads.add(t);
            t.start();
        }

        for (Thread t : threads) {
            t.join(); // 确保所有线程完成
        }

        System.out.println(listOfRainy.getSelectionResult().toString());
    }
}
